/**********************************************************************************
 * Code license:  GNU General Public License v3                                   *
 * Main page:     https://code.google.com/p/library-cross-platform/               *
 * Issue tracker: https://code.google.com/p/library-cross-platform/issues/list    *
***********************************************************************************/

package library.compiler;

public class Double implements Variable {

  protected double value;
  
  public Double() {
    value = 0.;
  }

  public Double(double value) {
    this.value = value;
  }

  public Double(Double value) {
    this.value = value.value;
  }

  public double value() {
    return value;
  }

/**
 * operator '==' 
 * @param type
 * @return if type is equal this then true otherwise false
 */
  public boolean equal(Variable type) {
    return value == ((Double)type).value;
  }

/**
 * operator '!=' 
 * @param type
 * @return if type is not equal this then true otherwise false
 */
  public boolean notequal(Variable type) {
    return value != ((Double)type).value;
  }

/**
 * operator '=' 
 * assign the type to this
 * @param type
 * @return new type
 */
  public Variable assign(Variable type) {
    value = ((Double)type).value;
    return this;
  }

/**
 * operator '+' 
 * the type plus this type
 * @param type
 * @return new type
 */
  public Variable plus(Variable type) {
    value += ((Double)type).value;
    return this;
  }

/**
 * operator '-' 
 * the type minus this type
 * @param type
 * @return new type
 */
  public Variable minus(Variable type) {
    value -= ((Double)type).value;
    return this;
  }

/**
  * operator '/' 
  * division operator
  * @param type
  * @return new type
  */
  public Variable div(Variable type) {
    value /= ((Double)type).value;
    return this;
  }

/**
  * operator '*' 
  * multiplication
  * @param type
  * @return new type
  */
  public Variable mult(Variable type) {
    value *= ((Double)type).value;
    return this;
  }

/**
  * operator '<>' 
  * is this type contains type or not.
  * NOT USED IN THIS TYPE
  * @param type
  * @return true if this type contains type otherwise false
  */
  public Variable contains(Variable type) {
    return null;
  }
}
